package com.dhcc.core.modules.system.warpper;

import com.dhcc.core.framework.base.warpper.BaseControllerWarpper;
import com.dhcc.core.framework.util.CommonUtil;
import com.dhcc.core.framework.util.SpringContextHolder;
import com.dhcc.core.modules.system.service.ISplitTablesService;

import java.util.Map;

/**
 * 数据库分表列表的包装类
 * 
 * @ClassName: SplitTableWarpper
 * @Description: TODO
 * @author: syj
 * @date: 2022年3月12日 上午10:43:50
 */
public class SplitTableWarpper extends BaseControllerWarpper {

    private ISplitTablesService splitTablesService = SpringContextHolder.getBean(ISplitTablesService.class);

    public SplitTableWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
        Long pid = (Long) map.get("parentId");
        if(CommonUtil.isEmpty(pid)||pid==0){
            map.put("parentCode", "");
        }else{
            map.put("parentCode", splitTablesService.getTableCodeById(pid));
        }
    }

}
